import os

while True:
	filename = raw_input("enter filename:")

	if(os.path.exists(filename)):
		print "%s is already exists" % filename
	else:
		break

all = []

print 'input string,if input . exit'

while True:
	line = raw_input("> ")

	if(line == '.'):
		break
	else:
		all.append(line)

fobj = open(filename,'w')
fobj.writelines(["%s\n" % x for x in all])
fobj.close()

print 'DONE'
